#include "path.h"

Path::Path() : q(Queue<Pair<int, int>>())
{}

Path::Path(const Pair<int, int> &start) : q(Queue<Pair<int, int>>()) {
    this->q.Push(start);
}

Path::Path(const Path &other) : q(other.q)
{}

void Path::AddNode(const Pair<int, int> &node) {
    this->q.Push(node);
}

QString Path::ToString() const {
    if (q.IsEmpty()) return "";
    Pair<int, int> x;
    QString res;
    for (auto ptr = q.head; ptr->nxt != nullptr; ptr = ptr->nxt) {
        if (ptr != q.head) {
            res += " -> ";
        }
        x = ptr->nxt->val;
        res += "<" + QString::number(x.first) + "," + QString::number(x.second) + ">";
    }
    return res;
}

Path& Path::operator=(const Path &other) {
    this->q = other.q;
    return *this;
}
